<?php

if(!defined('IN_ECS'))
{
	die('Hacking attempt');
}

class ECS
{
	var $db_name = '';
	var $prefix = 'ecs_';
	
	function ECS($db_name,$prefix)
	{
		$this->db_name = $db_name;
		$this->prefix = $prefix;
	}
	
	function table($str)							//拼接数据库表名
	{
		return '`' . $this->db_name .'`.`' . $this->prefix . $str . '`';
	}
	
	function data_dir($sid = 0)							//数据备份路径
	{
		if(empty($sid))
		{
			$s = 'data';
		}else 
		{
			$s = 'user_files/';
			$s .= ceil($sid/1000) . '/';
			$s .= $sid % 3000;
		}
		return $s;
	}
	
	function image_dir($sid = 0)						//图片路径
	{
		if(empty($sid))
		{
			$s = 'images';
		}else 
		{
			$s = 'user_files/';
			$s .= ceil($sid/1000) . '/';
			$s .= $sid % 3000 .'/';
			$s .= 'images';
		}
		return $s;
	}
}
